<?php

/*
 * Enable seessions
 */
 
session_start();

if(!isset($_SESSION['token'])) {
	$_SESSION['token'] = sha1(uniqid(mt_rand(), TRUE));
}


/*
 * Include necessary config info
 */
include_once $_SERVER['DOCUMENT_ROOT'].'/workout/config/db-cred.inc.php';

/*
 * Define constants
 */
foreach($C as $name=>$value) {
	define($name, $value);
}

/*
 * Create a PDO object
 */
$dsn = "mysql:host=".DB_HOST.";dbname=".DB_NAME;
$dbo = new PDO($dsn, DB_USER, DB_PASS);

/*
 * Define auto-load function for classes
 */
function __autoload($class) {
	$filename = $_SERVER['DOCUMENT_ROOT']."/workout/class/class.".strtolower($class).".inc.php";
	if(file_exists($filename)) {
		include_once $filename;
	}
}


?>